package io.openmessaging.utils;

/**
 * @author cuijd    2021/9/14 9:12
 */
public interface Assert {
    static void isTrue(boolean expr, Object... msg) {
        StringBuilder sb = new StringBuilder(Thread.currentThread().getName());
        if (!expr) {
            if (msg == null || msg.length == 0)
                throw new RuntimeException(sb.toString());
            sb.append(" ");
            if (msg.length == 1)
                throw new RuntimeException(sb.append(msg[0]).toString());
            for (Object s : msg) {
                sb.append(s);
            }
            throw new RuntimeException(sb.toString());
        }
    }
}
